package kr.hkit.powerjava.chapter12.work;

import java.util.Arrays;
//stack, queue,
public class Stack {
	private int size;
	private int top;
	private String[] arrItem;

	public Stack(int size) {

		this.size = size;
		arrItem = new String[size];
		top = -1;
	}

	public void push(String Item) {
		if (!isFull()) {
			arrItem[++top] = Item;
		} else {
			System.out.println("full");
		}

	}

	public boolean isFull() {
		return top == size - 1;

	}

	public boolean isEmpty() {
		return top == -1;
	}

	public String pop() {
		if (!isEmpty()) {
			return arrItem[top--];
		} else {
			return "Empty";

		}
	}

	public void prnStack() {
		for (int i = 0; i < top; i++) {
			System.out.printf("[%s]\t", arrItem[i]);

		}
		System.out.println();
	}

}
